package com.pllandxzx.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseDTO {
    private String message;
    private int code;
    private Object data;

    public ResponseDTO(ResponseStatus responseStatus) {
        this.code = responseStatus.getCode();
        this.message = responseStatus.getMessage();
    }

    public static ResponseDTO Success(Integer code, String message, Object data) {
        return new ResponseDTO(message,code,data);
    }

    public static ResponseDTO Success(Integer code, String message) {
        return new ResponseDTO(message,code,null);
    }

    public static ResponseDTO Success(Object data) {
        return new ResponseDTO("成功",200,data);
    }

    public static ResponseDTO Fail(Integer code, String message) {
        return new ResponseDTO(message,code,null);
    }
}
